#!/usr/bin/env bash

name="ka-admin-dev"
version="latest"

if [ "$1" == "-v" ]
then
    version="$2"
fi
echo "当前版本:$version"
echo "开始构建生产Docker镜像"
npm run build:dev
echo "开始构建docker镜像"
docker build --platform=linux/amd64 . -t=uhub.service.ucloud.cn/techstrategy/$name:$version
echo "推送至私有库"
docker push --platform=linux/amd64 uhub.service.ucloud.cn/techstrategy/$name:$version
echo "删除本地镜像"
docker rmi -f uhub.service.ucloud.cn/techstrategy/$name:$version